using System.Collections.Generic;
using System.Linq;

namespace DataScripter.Scripting.Processes.Morphs
{
    public class MorphActionsDefinition : IMorphActionsDefinition
    {
        private readonly List<ITableMorphAction> _tableMorphActions = new List<ITableMorphAction>();

        public MorphActionsDefinition(string name)
        {
            Name = name;
        }

        #region Implementation of IMorphActionsDefinition

        public string Name { get; set; }

        #endregion

        public void AddMorphAction(ITableMorphAction tableMorphAction)
        {
            _tableMorphActions.Add(tableMorphAction);    
        }

        public IEnumerable<ITableMorphAction> GetMorphActionsForTable(string tableName)
        {
            return _tableMorphActions.Where(ma => ma.ShouldBeAppliedOnTable(tableName));
        }
    }
}